<%@ page import="user.User" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <title>编辑个人信息</title>
    <style>
        /* 全局样式 */
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: 'Segoe UI', 'PingFang SC', 'Microsoft Yahei', sans-serif;
            background: linear-gradient(135deg, #e0f7fa, #f3e5f5);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 40px 20px;
            color: #333;
        }

        .card {
            background: white;
            width: 100%;
            max-width: 400px;
            padding: 30px 25px;
            border-radius: 16px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
            transition: all 0.3s ease;
        }

        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
        }

        h2 {
            text-align: center;
            margin-bottom: 24px;
            font-weight: 600;
            color: #374151;
        }

        label {
            display: block;
            margin-bottom: 5px;
            color: #4b5563;
        }

        input[type="text"], input[type="email"], input[type="number"] {
            width: 100%;
            padding: 8px;
            margin-bottom: 1rem;
            border: 1px solid #ccc;
            border-radius: 6px;
        }

        button {
            width: 100%;
            padding: 10px;
            background-color: #d1ecf1;
            color: #15576b;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 16px;
        }

        button:hover {
            background-color: #aee2eb;
            color: #0f3d4d;
        }

        a {
            display: block;
            text-align: center;
            margin-top: 10px;
            color: #15576b;
            text-decoration: none;
        }

        a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>

<%
    User user = (User) session.getAttribute("user");
    if (user == null) {
        response.sendRedirect("login.jsp");
        return;
    }
%>

<div class="card">
    <h2>编辑个人信息</h2>
    <form action="UpdateProfileServlet" method="post">
        <label for="username">用户名：</label>
        <input type="text" id="username" name="username" value="<%= user.getUsername() %>" readonly />

        <label for="email">邮箱：</label>
        <input type="email" id="email" name="email" value="<%= user.getEmail() %>" required />

        <label for="age">年龄：</label>
        <input type="number" id="age" name="age" value="<%= user.getAge() %>" min="0" max="150" required />

        <button type="submit">保存更改</button>
    </form>
    <a href="user_massage.jsp">返回个人信息页</a>
</div>

</body>
</html>
